<template>
  <div class="dialog">
    <el-dialog
      title="设备"
      :visible.sync="showDialog"
      width="45%"
      top="0"
      :close-on-click-modal="false"
      @close="cancel"
    >
      <el-form
        ref="ruleForm"
        label-position="left"
        label-width="120px"
        :model="formData"
        class="el-form"
      >
        <el-form-item style="width: 100%" label="加工产品：">
          <el-input
            v-for="item,index in equipList"
            :key="index"
            v-model="item.equipmentName"
            disabled
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button class="cancelbtn" @click="cancel()">取 消</el-button>
        <el-button
          v-if="false"
          type="primary"
          class="savebtn"
          @click="save('ruleForm')"
        >保 存</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: "Addeditdialog",
  components: {},
  props: {
    equipList: {
      type: Array,
      default: () => []
    },
    // 弹框名称
    titleText: {
      type: String,
      default: ""
    },
    show: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      showDialog: this.show,
      // 展示
      formData: {
        img: "",
        equipmentName: "",
        operationMode: ""
      },
      pictureList: [],
      options: [
        {
          value: "选项1",
          label: "黄金糕"
        },
        {
          value: "选项2",
          label: "双皮奶"
        }
      ]
    };
  },

  watch: {
    show(v) {
      this.showDialog = v;
    }
  },
  created() {},
  mounted() {},
  methods: {
    add() {
      this.devs.push("测试3");
    },
    save(formData) {
      this.$refs[formData].validate(valid => {
        if (valid) {
          console.log(this.formData);
        }
      });
    },
    close() {
      this.$emit("closeDialog");
    },
    cancel() {
      this.$emit("closeDialog");
      this.formData = {};
    }
  }
};
</script>

<style lang="scss" scoped>
::v-deep .el-form-item__content {
  margin-left: 0 !important;
  display: flex;
  flex-wrap: wrap;
  .el-input {
    width: 48%;
    margin-bottom: 10px;
    margin-right: 1%;
  }
}
</style>
